// pages/help/help.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    img: {
      logo: 'http://delice.riki.cn/mavista/img/riki-baby-logo.svg',
      bee: 'http://delice.riki.cn/mavista/img/bee-label.png',
      fan: 'http://delice.riki.cn/mavista/img/home-fan.png',
      pig: 'http://delice.riki.cn/mavista/img/home-pig.png',
      rabbit: 'http://delice.riki.cn/mavista/img/home-rabbit.png',
      start: 'http://delice.riki.cn/mavista/img/home-heart-start.png',
      lakto: 'http://delice.riki.cn/mavista/img/home-lakto-logo.png',
      disclosure: 'http://delice.riki.cn/mavista/img/disclosure_button.png'
    },
    listCon: [
      'http://delice.riki.cn/mavista/img/home_green.png',
      'http://delice.riki.cn/mavista/img/home_ornge.png',
      'http://delice.riki.cn/mavista/img/home_yellow.png',
      '../../images/home_pink.jpg'
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.getSystemInfo({
      success(res) {
        that.setData({
          screenHeight: res.screenHeight,
          screenWidth: res.screenWidth
        })
      }
    })
    var animation1 = wx.createAnimation({
      duration: Infinity,
      timingFunction: 'ease'
    })
    
    setInterval(function () {
      animation1.translateY(4).step({ duration: 500 }).translateY(-4).step({ duration: 500 });
      that.setData({
        animationData: animation1.export()
      })
    }, 1000)
    var animation2 = wx.createAnimation({
      duration: 2000,
      timingFunction: 'ease'
    })
    let widthLeft = this.data.screenWidth*32/100;
    console.log(widthLeft)
    animation2.translateX(-widthLeft).step({duration:500});
    that.setData({
      animationData2:animation2.export()
    })

    var animation3 = wx.createAnimation({
      duration: 2000,
      timingFunction: 'ease'
    })
    let widthRight = this.data.screenWidth * 25 / 100+15;
    console.log(widthRight)
    animation3.translateX(widthRight).step({ duration: 500 });
    that.setData({
      animationData3: animation3.export()
    })

    var animation4 = wx.createAnimation({
      duration: 2000,
      timingFunction: 'ease'
    })
    
    animation4.scale(2).step({ duration: 500 });
    that.setData({
      animationData4: animation4.export()
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  },
  btnPages(e) {
    console.log(e)
    let index = e.currentTarget.dataset.index;
    if(index==3){
      wx.navigateTo({
        url: 'question/question?index=' + index,
      })
    }else {
      wx.navigateTo({
        url: 'helpShow/helpShow?index=' + index,
      })
    }
    
  },
  disclosure(){
    wx.switchTab({
      url: '../search/search',
    })
  }
})